package com.example.demo.lambda;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

/**
 * @Author xiao
 * @Date 2025/5/2 下午 4:28
 * @ClassName: OrderFieldEnum
 * @Desc:
 */
public enum OrderFieldEnum {

    date(0,"日期"),
    orderId(1,"订单编号"),
    goodsId(2,"商品编号"),
    userId(3,"用户编号"),
    price(4,"商品价格"),
    num(5,"商品数量"),
    totalPrice(6,"商品总价"),
    addr(7,"地址");

    OrderFieldEnum(Integer field, String desc) {
        this.field = field;
        this.desc = desc;
    }

    public static OrderFieldEnum getByField(Integer field) {
        for (OrderFieldEnum value : OrderFieldEnum.values()) {
            if (value.field.equals(field)) {
                return value;
            }
        }
        return null;
    }

    @Getter
    private Integer field;
    private String  desc;
}
